/*     */ package btsm.servlet;
/*     */ 
/*     */ import btsm.bean.sqlBTSWork;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintStream;
/*     */ import javax.servlet.RequestDispatcher;
/*     */ import javax.servlet.ServletException;
/*     */ import javax.servlet.http.HttpServlet;
/*     */ import javax.servlet.http.HttpServletRequest;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class ser_dicmgr extends HttpServlet
/*     */ {
/*     */   public void init()
/*     */     throws ServletException
/*     */   {
/*     */   }
/*     */ 
/*     */   public void doGet(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/*  20 */     sqlBTSWork PC = new sqlBTSWork("dictionary", "1");
/*     */ 
/*  22 */     String seraction = request.getParameter("seraction");
/*  23 */     String strdictype = request.getParameter("dictype");
/*     */ 
/*  25 */     String strsnid = request.getParameter("snid");
/*  26 */     String strToPage = request.getParameter("ToPage");
/*  27 */     if (strToPage == null) {
/*  28 */       strToPage = request.getParameter("tToPage");
/*     */     }
/*     */ 
/*  33 */     if (seraction.equalsIgnoreCase("serinsertsimple"))
/*     */     {
/*  37 */       String[] fieldxg = request.getParameterValues("T1");
/*  38 */       String filesnames = request.getParameter("filesnames");
/*     */ 
/*  40 */       boolean result = PC.insertMD(fieldxg, strsnid);
/*     */ 
/*  45 */       if (result) {
/*  46 */         String msg = "";
/*  47 */         msg = msg + "新建字典成功";
/*  48 */         request.setAttribute("msg", msg);
/*  49 */         filesnames = filesnames.replaceAll("list", "md");
/*  50 */         request.setAttribute("filesnames", "ser_dicmgr?seraction=sermodp&dictype=" + strdictype + "&filesnames=" + filesnames);
/*     */ 
/*  52 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/*  53 */         btsm.forward(request, response);
/*     */       }
/*     */       else {
/*  56 */         String msg = "";
/*  57 */         msg = msg + "新建字典失败";
/*  58 */         request.setAttribute("msg", msg);
/*  59 */         filesnames = filesnames.replaceAll("list", "md");
/*  60 */         request.setAttribute("filesnames", "ser_dicmgr?seraction=sermodp&dictype=" + strdictype + "&filesnames=" + filesnames);
/*     */ 
/*  62 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/*  63 */         btsm.forward(request, response);
/*     */       }
/*     */     }
/*  66 */     else if (seraction.equalsIgnoreCase("sermodp"))
/*     */     {
/*  68 */       String filesnames = request.getParameter("filesnames");
/*  69 */       filesnames = filesnames.replaceAll("list", "md");
/*  70 */       request.setAttribute("dictype", strdictype);
/*  71 */       request.setAttribute("snid", strsnid);
/*  72 */       request.setAttribute("ToPage", strToPage);
/*  73 */       System.out.println("strToPageLGMODP:" + strToPage);
/*  74 */       if (strToPage == null)
/*  75 */         strToPage = "1";
/*  76 */       RequestDispatcher btsm = request.getRequestDispatcher("nnmd_dicmgr.jsp?ToPage=" + strToPage);
/*  77 */       btsm.forward(request, response);
/*  78 */     } else if (seraction.equals("serdel"))
/*     */     {
/*  80 */       String filesnames = request.getParameter("filesnames");
/*  81 */       filesnames = filesnames.replaceAll("list", "md");
/*  82 */       request.setAttribute("filesnames", "ser_dicmgr?seraction=sermodp&dictype=" + strdictype + "&filesnames=" + filesnames);
/*  83 */       request.setAttribute("dictype", strdictype);
/*     */ 
/*  85 */       boolean result = PC.delbyid(strsnid);
/*  86 */       if (result) {
/*  87 */         String msg = "";
/*  88 */         msg = msg + "字典信息删除成功";
/*  89 */         request.setAttribute("msg", msg);
/*     */ 
/*  91 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/*  92 */         btsm.forward(request, response);
/*     */       } else {
/*  94 */         String msg = "";
/*  95 */         msg = msg + "字典删除失败";
/*  96 */         request.setAttribute("msg", msg);
/*     */ 
/*  98 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/*  99 */         btsm.forward(request, response);
/*     */       }
/*     */     }
/* 102 */     else if (seraction.equals("sermod"))
/*     */     {
/* 106 */       PC.wheresw = strsnid;
/* 107 */       String[] fieldxg = request.getParameterValues("T1");
/* 108 */       String filesnames = request.getParameter("filesnames");
/* 109 */       filesnames = filesnames.replaceAll("md", "list");
/* 110 */       boolean result = PC.mdByID(fieldxg, strsnid);
/* 111 */       request.setAttribute("filesnames", "ser_dicmgr?seraction=sermodp&dictype=" + strdictype + "&filesnames=" + filesnames + "&snid=" + strsnid + "&ToPage=" + strToPage);
/*     */ 
/* 113 */       if (result) {
/* 114 */         String msg = "";
/* 115 */         msg = msg + "字典信息修改成功";
/* 116 */         request.setAttribute("msg", msg);
/* 117 */         request.setAttribute("dictype", strdictype);
/* 118 */         request.setAttribute("ToPage", strToPage);
/*     */ 
/* 120 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/* 121 */         btsm.forward(request, response);
/*     */       } else {
/* 123 */         String msg = "";
/* 124 */         msg = msg + "字典修改失败";
/* 125 */         request.setAttribute("msg", msg);
/*     */ 
/* 127 */         request.setAttribute("dictype", strdictype);
/* 128 */         request.setAttribute("ToPage", strToPage);
/*     */ 
/* 130 */         RequestDispatcher btsm = request.getRequestDispatcher("common.jsp");
/* 131 */         btsm.forward(request, response);
/*     */       }
/*     */     }
/*     */   }
/*     */ 
/*     */   public void doPost(HttpServletRequest request, HttpServletResponse response)
/*     */     throws ServletException, IOException
/*     */   {
/* 139 */     doGet(request, response);
/*     */   }
/*     */ 
/*     */   public void destroy()
/*     */   {
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.servlet.ser_dicmgr
 * JD-Core Version:    0.6.2
 */